home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Eagles Nest BBS 8
/
Eagles_Nest_Mac_Collection_Disc_8.TOAST
/
Developer Tools⁄Additions
/
InsideBa1994
/
InsideBasic-94
/
IB 94
/
Simple DB
/
wData.FLTR
< prev
next >
Wrap
Text File
|
1993-10-24
|
4KB
|
178 lines
'===============================================================================
'= Copyright 1992 Staz™ Software, Inc. =
'= All rights reserved =
'= "Project.INCL" from PG:PRO =
'===============================================================================
INCLUDE FILE _aplIncl
COMPILE 0,_MacsbugLabels_strResource_caseInsensitive'set by PG:PRO
'
GLOBALS "PG PRO.GLBL"
GLOBALS "Simple DB.GLBL"
END GLOBALS
'===============================================================================
GOTO "wData"
'===============================================================================
INCLUDE "@Header.INCL"
LOCAL FN clearData
DEF BLOCKFILL(@gClients,_gClientSz,0)
FOR x = 0 TO _maxClients
DEF BLOCKFILL(@gClientData(x),_gClientSz,0)
NEXT
gDirty = _false
END FN
LOCAL FN newFile
FN clearData
gSaveName$ = "untitled"
FN pGbuild(_dataWnd)
gCurrRecord = 1
END FN
LOCAL FN showRecord
EDIT$(_lastNameFld ) = gClientData.gClientLName$(gCurrRecord)
EDIT$(_firstNameFld) = gClientData.gClientFName$(gCurrRecord)
EDIT$(_phoneFld ) = gClientData.gClientPhone$(gCurrRecord)
EDIT FIELD _lastNameFld
gRecDirty = _false
t$ = "Record" +STR$(gCurrRecord)
CALL SETWTITLE(WINDOW(_wndpointer),t$)
END FN
LOCAL FN readData
FN newFile
gSaveName$ = gFileName$
gSaveVol = gFileVol
OPEN "R",#1,gSaveName$,_gClientSz,gSaveVol
recCount = LOF(1)
FOR theRec = 1 TO recCount
READ FILE #1,@gClientData(theRec),_gClientSz
NEXT
CLOSE #1
gDirty = _false
FN showRecord
END FN
LOCAL FN writeData
OPEN "R",#1,gSaveName$,_gClientSz,gSaveVol
CLOSE #1
KILL gSaveName$,gSaveVol
DEF OPEN = "FONEHOME"
OPEN "R",#1,gSaveName$,_gClientSz,gSaveVol
FOR theRec = 1 TO _maxClients
LONG IF LEN(gClientData.gClientLName$(theRec))
WRITE FILE #1,@gClientData(theRec),_gClientSz
END IF
NEXT theRec
CLOSE #1
REM PG clears the gDirty flag!
END FN
LOCAL FN saveRecord
gClientData.gClientLName$(gCurrRecord) = EDIT$(_lastNameFld )
gClientData.gClientFName$(gCurrRecord) = EDIT$(_firstNameFld)
gClientData.gClientPhone$(gCurrRecord) = EDIT$(_phoneFld )
gRecDirty = _false
gDirty = _ztrue
END FN
LOCAL FN nextRecord
INC(gCurrRecord)
FN showRecord
END FN
LOCAL FN previousRecord
DEC(gCurrRecord)
FN showRecord
END FN
LOCAL FN dataNulls
LONG IF gWhichClass = _dataWnd
BUTTON _previousBtn,1+(gCurrRecord = 1)
'LONG IF gCurrRecord = 1
'BUTTON _previousBtn,_disable
'XELSE
'BUTTON _previousBtn,_enable
'END IF
LONG IF gCurrRecord = _maxClients
BUTTON _NextBtn,_disable
XELSE
BUTTON _NextBtn,_enable
END IF
LONG IF gRecDirty
BUTTON _saveBtn,_enable
XELSE
BUTTON _saveBtn,_disable
END IF
END IF
END FN
LOCAL FN dataMenu
SELECT gItemName$
CASE "New" :FN newFile
END SELECT
END FN
LOCAL FN dataButtons
LONG IF gWhichClass = _dataWnd
SELECT gWhichButton
CASE _previousBtn:FN previousRecord
CASE _NextBtn :FN nextRecord
CASE _saveBtn :FN saveRecord
END SELECT
END IF
END FN
LOCAL FN dataMain
SELECT gSubAction
CASE _mainOpen:
LONG IF WINDOW(-_dataWnd)
BEEP
XELSE
FN readData
END IF
CASE _mainSave:FN writeData
CASE _mainStart:gOpenType$ = gOpenType$ + "FONE"
END SELECT
END FN
LOCAL FN dataOther
SELECT gSubAction
CASE _otherNullEvent
FN dataNulls
CASE _otherUser
LONG IF gDialogValue = _showNewRec
WINDOW _dataWnd
FN showRecord
END IF
CASE _otherBeforeMenu
LONG IF WINDOW(-_dataWnd)
MENU _fileMenu,_newItem,_disable
MENU _fileMenu,_openItem,_disable
XELSE
MENU _fileMenu,_newItem,_enable
MENU _fileMenu,_openItem,_enable
END IF
END SELECT
END FN
LOCAL FN dataFields
LONG IF gSubAction = _fieldKeyPressed
LONG IF gWhichClass = _dataWnd
gRecDirty = _zTrue
END IF
END IF
END FN
'===============================================================================
"wData"
'===============================================================================
SELECT gAction
CASE _menuAction : FN dataMenu
CASE _buttonAction : FN dataButtons
CASE _mainAction : FN dataMain
CASE _otherAction : FN dataOther
CASE _fieldAction : FN dataFields
END SELECT